<?php

class BuildingsDownTownPlugin {
    var $ld;
    var $xmlsOb;
    var $bot;
    var $translate;
    var $LangNotice;
    var $XMLtransl;
	
	var $settings;
	
	var $ResidenceObjects = array();
	var $CustomResidenceObjects = array();
	var $SkyscraperObjects = array();
	var $NeighborhoodObjects = array();
	var $HotelObjects = array();
	var $MallObjects = array();
	var $ThemeParkObjects = array();
	var $ZooEnclosureObjects = array();
	var $PowerStationObjects = array();
	var $BusinessObjects = array();
	var $PremBusinessObjects = array();
	var $TimedBusinessObjects = array();
	var $MunicipalCenterObjects = array();
	var $MunicipalObjects = array();
	var $LandmarkObjects = array();
	
	var $world = "Downtown";
	//var $world = "Main";
	
	function BuildingsDownTownPlugin()
	{
		$this->ld = new LocalData();
		$this->xmlsOb = new xmlsOb();
		$bot = new Bot();
		$SetLangauge = $bot->GetParamByName("language");
		
		$LangPath = 'Plugins/Buildings/lang/';
		$disableNotices = TRUE; //FALSE; // TRUE for production, so no errors are shown.
		$LangRoute = array( 'de' => 'en', 'es' => 'en', 'fr' => 'en', 'tr' => 'en', 'it' => 'en', 'pt' => 'en', 'nl' => 'en', 'da' => 'en', 'nb' => 'en', 'pl' => 'en', 'ru' => 'en' );
		$this->translate = new Zend_Translate( array('adapter' => 'tmx', 'content' => $LangPath, 'locale'  => 'en', 'route' => $LangRoute , 'disableNotices' => $disableNotices));
		$this->translate->setLocale($SetLangauge);
		
		if (!$this->translate->isAvailable($SetLangauge))
		{ // not available languages are rerouted to english
			$this->LangNotice = "Your language is not (yet) available. We use English where needed.<br>";
			$this->translate->setLocale('en');
		}
		else
		{
			$this->LangNotice = "";
		}

		// Create a log instance
		$writer = new Zend_Log_Writer_Stream('tmp_dir/Lang_Log/Buildings-DownTown_Lang.log');
		$log    = new Zend_Log($writer);
		$this->translate->setOptions( array('log' => $log, 'logUntranslated' => true ));
		//now load the langauge from the game.xml
		$this->XMLtransl = new transl($SetLangauge);
		///  $XMLtransl->langXML
	}
	
	function t($trans)
	{ // look for translation in XML
		if ($this->translate->isAvailable($trans))
		{
			return  htmlentities($this->translate->_($trans), ENT_QUOTES, "UTF-8");
		}
		else
		{
			if(array_key_exists($trans, $this->XMLtransl->langXML)) return $this->XMLtransl->langXML[$trans];
			//_friendlyName
			$trans2 = $trans . "_friendlyName";
			if(array_key_exists($trans2, $this->XMLtransl->langXML)) return $this->XMLtransl->langXML[$trans2];
		}
		return  htmlentities($this->translate->_($trans), ENT_QUOTES, "UTF-8");
	}
	
	function GetXMLtime($time)
	{
		$tmptime = (string)$time*(23/24); // now the time is in days.
		$tmptime = $tmptime * 24 * 60 ; // now time is in min.
		if($tmptime >= 0 && $tmptime < 60){ $tmptime= round($tmptime, 1)." Min."; }
		if($tmptime >= 60 && $tmptime < 3600){ $tmptime= round($tmptime/60, 1)." Hour"; }
		if($tmptime >= 3660 && $tmptime < 86400){ $tmptime= round($tmptime/60/24, 1)." Day"; }
		$nicetime = $tmptime;
		return $nicetime;
	}
	
	function ClassifyObjects()
	{
		if ($this->world == "Downtown")
			$objects = $this->ld->GetDTObjects();
		else
			$objects = $this->ld->GetObjects();

			foreach ($objects as $obj)
		{
			switch ($obj['className'])
			{
				case 'Residence';
					$this->ResidenceObjects[$obj['id']] = $obj;
					break;
				case 'CustomResidence';
					$this->CustomResidenceObjects[] = $obj;
					break;
				case 'Skyscraper';
					$this->SkyscraperObjects[] = $obj;
					break;
				case 'Neighborhood';
					$this->NeighborhoodObjects[] = $obj;
					break;
				case 'Hotel';
				case 'SocialBusiness';
					$this->HotelObjects[] = $obj;
					break;
				case 'Mall';
					$this->MallObjects[] = $obj;
					break;
				case 'ThemePark';
					$this->ThemeParkObjects[] = $obj;
					break;
				case 'ZooEnclosure';
					$this->ZooEnclosureObjects[] = $obj;
					break;
				case 'PowerStation';
					$this->PowerStationObjects[] = $obj;
					break;
				case 'Business';
					switch ($this->xmlsOb->GetBusinessCommodity($obj['itemName']))
					{
						case 'goods';
							$this->BusinessObjects[] = $obj;
							break 2;
						case 'premium_goods';
							$this->PremBusinessObjects[] = $obj;
							break 2;
					}
				case 'TimedBusiness';
					$this->TimedBusinessObjects[] = obj;
					break;
				case 'MunicipalCenter';
					$this->MunicipalCenterObjects [] = $obj;
					break;
				case 'Municipal';
				case 'University';
					$this->MunicipalObjects[] = $obj;
					break;
				case 'Landmark';
					$this->LandmarkObjects[] = $obj;
					break;
			}
		}
	}
	
	function OutputHeader($title)
	{
		echo '				<table border="1" cellspacing="1" cellpadding="1" width="100%" bgcolor="#ff0066">
								<tr height="23"><td><h3>'.$title.'</h3></td></tr>
							</table>
							<br>';
	}
	
	function GetForm()
	{
		//global $imagePath;
		//$imagePath = substr($_SERVER["PHP_SELF"], 0, strpos($_SERVER["PHP_SELF"], "/"));
		$PlVersion = (array)$this->ld->GetPlVersion('buildings-downtown');
		$this->settings = (array) $this->ld->GetPlSettings('buildings-downtown');
	  
		echo '	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
				"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
				<html xmlns="http://www.w3.org/1999/xhtml" lang="ru">
					<head>
						<title>Buildings</title>
						<script src="..\..\codebase-php\jquery-1.4.2.min.js"></script>
						<script src="..\..\codebase-php\jquery.json-2.2.min.js"></script>
						<link href="helpers/plugin.css" rel="stylesheet" type="text/css">
						<style>
							#maint{ font-size: 10pt; width: 850px; padding: 0px; }
						</style>
						
						<script language="JavaScript" type="text/javascript">
							<!--
								var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);
								
								function addOption(theSel, theText, theValue)
								{
									var newOpt = new Option(theText, theValue);
									var selLength = theSel.length;
									theSel.options[selLength] = newOpt;
								}

								function deleteOption(theSel, theIndex)
								{
									var selLength = theSel.length;
									if(selLength>0)
									{
										theSel.options[theIndex] = null;
									}
								}

								function moveOptions(theSelFrom, theSelTo)
								{
									var selLength = theSelFrom.length;
									var selectedText = new Array();
									var selectedValues = new Array();
									var selectedCount = 0;
									var i;
									// Find the selected Options in reverse order and delete them from the from Select.
									for(i=selLength-1; i>=0; i--)
									{
										if(theSelFrom.options[i].selected)
										{
											selectedText[selectedCount] = theSelFrom.options[i].text;
											selectedValues[selectedCount] = theSelFrom.options[i].value;
											deleteOption(theSelFrom, i);
											selectedCount++;
										}
									}

									// Add the selected text/values in reverse order.
									// This will add the Options to the TO Select
									// in the same order as they were in the FROM Select.
									for(i=selectedCount-1; i>=0; i--)
									{
										addOption(theSelTo, selectedText[i], selectedValues[i]);
									}

									if(NS4) history.go(0);
								}
							//-->
						</script>

						<script language="javascript">
							<!-- For select images box
								function showimage()
								{
									if (!document.images) return
									document.images.pictures.src=document.mygallery.picture.options[document.mygallery.picture.selectedIndex].value
								}
							//-->
						</script>

						<script>
						function sortSelect(selElem) {
							var tmpAry = new Array();
							for (var i=0;i<selElem.options.length;i++) {
								tmpAry[i] = new Array();
								tmpAry[i][0] = selElem.options[i].text;
								tmpAry[i][1] = selElem.options[i].value;
							}
							tmpAry.sort();
							while (selElem.options.length > 0) {
								selElem.options[0] = null;
							}
							for (var i=0;i<tmpAry.length;i++) {
								var op = new Option(tmpAry[i][0], tmpAry[i][1]);
								selElem.options[i] = op;
							}
							return;
						}

						//==============================================================
						window.reload = function(){
							var l=window.location.toString();
							var indx=l.indexOf(\'?\');
							window.location=l.slice(0, indx)+"?action=refresh&tmp="+Math.random();
						}
						//==============================================================
						$(document).ready(function(){
							window.settings=eval(' . json_encode($this->ld->GetPlSettings('buildings-downtown')) . ');
							if ((window.settings!==null) && (window.settings!==undefined))
							{
								$(":checkbox").each(function(){
									if(window.settings[$(this).attr("id")]==true){
										$(this).attr("checked", true);
									}else{
										$(this).attr("checked", false);
									}
								});

								$(":radio").each(function(){
									if(window.settings[$(this).attr("id")]==true){
										$(this).attr("checked", true);
									}else{
										$(this).attr("checked", false);
									}
								});
									
								$(":text").each(function (){
									var attr=$(this).attr("id");
									if (window.settings[attr]!==null){
										$(this).val(window.settings[attr]);
									}else{
										$(this).val("0");
									}
								});
							}
							//==============================================================
							$("#btn_save").click(function(){
								var req=new Object();
								$(":checkbox").each(function(){
									var par=$(this).attr("id");
									req[par]=$(this).attr("checked");
									if (($(this).attr("objid")!==null) && ($(this).attr("objid")!==undefined))
									{
										req[par+"ID"]=$(this).attr("objid");
									}
								});
								$(":radio").each(function(){
									var par=$(this).attr("id");
									req[par]=$(this).attr("checked");
									if (($(this).attr("objid")!==null) && ($(this).attr("objid")!==undefined))
									{
										req[par+"ID"]=$(this).attr("objid");
									}
								});
								$("input:text").each(function(){
									req[$(this).attr("id")]=$(this).val();
								});
										
								req.collectbbIN=new Array();
								$("#collectbbIN option").each(function(){
									var par=$(this).val();
									req.collectbbIN.push(par);
								});
										
								req.collectpbbIN=new Array();
								$("#collectpbbIN option").each(function(){
									var par=$(this).val();
									req.collectpbbIN.push(par);
								});

								req.collectRentIN=new Array();
								$("#collectRentIN option").each(function(){
									var par=$(this).val();
									req.collectRentIN.push(par);
								});
										
								req.collectMuIN=new Array();
								$("#collectMuIN option").each(function(){
									var par=$(this).val();
									req.collectMuIN.push(par);
								});
										
								req.collectLMIN=new Array();
								$("#collectLMIN option").each(function(){
									var par=$(this).val();
									req.collectLMIN.push(par);
								});
										
								req.collectCruiseIN=new Array();
								$("#collectCruiseIN option").each(function(){
									var par=$(this).val();
									req.collectCruiseIN.push(par);
								});
										
								req.collectPlaneIN=new Array();
								$("#collectPlaneIN option").each(function(){
									var par=$(this).val();
									req.collectPlaneIN.push(par);
								});
										
								data=$.toJSON(req);
								var l=window.location.toString();
								var indx=l.indexOf(\'?\');
								var nurl=l.slice(0, indx)+"?action=save&tmp="+Math.random();
								$.post(nurl, data);

								return false;
							});
						});
						</script>

					</head>
					
					<body>
						<form name="mygallery">
							<div ><span class="error">'.$this->LangNotice.'</span></div>
							<table border="1" cellspacing="1" cellpadding="1" width="100%" bgcolor="#DAA520">
								<tr height="23">
									<td><hr><h1>'.$this->t("Buildings-DownTown").'&nbsp;'.$this->t("v").$PlVersion['version'].'</h1>
									<h5>REVAMPED by Tonycell, Updated by BQ (31.01.2012), Updated for Downtown by Little Todd</h5><hr></td>
								</tr>
							</table>
							<br>
							<table border="1" cellspacing="1" cellpadding="1" width="100%" bgcolor="#ff0066">
								<tr height="23">
									<td><hr><h3><input type="checkbox" id="echeck">Auto-Check/Use Energy from your inventory?</h3><hr></td>
								</tr>
							</table>			
							<br>';
			
		$this->ClassifyObjects();
			
		if (count($this->ResidenceObjects) || count($this->CustomResidenceObjects) || count($this->SkyscraperObjects) || count($this->NeighborhoodObjects))
		{
			echo 			$this->OutputHeader("Residences");
			echo '			<input type="checkbox" id="collectrent">'.$this->t("Collect Residences").'?<br><br>
			                <table class="table66">
								<tr height="12">
									<td><b>Options</b>:</td>
									<td>
										<input type="checkbox" id="rentvacant">Collect Residences having vacant only?<br>
										<input type="checkbox" id="banditDT">Try to capture DT Bandit<br>
										<input type="checkbox" id="Rbonus">Streak Bonus<br>
									</td>
								</tr>
							</table>
							<br>';
			echo			$this->ResidenceOutput();
			echo			$this->CustomResidenceOutput();
			echo			$this->SkyscraperOutput();
			echo			$this->NeighborhoodOutput();
		}
			
		if (count($this->HotelObjects) || count($this->MallObjects))
		{
			echo 			$this->OutputHeader("Hotels & Malls");
			echo			$this->HotelOutput();
			echo			$this->MallOutput();
		}
		
		if (count($this->ThemeParkObjects))
		{
			echo 			$this->OutputHeader("ThemePark");
			echo			$this->ThemeParkOutput();
		}
			
		if (count($this->ZooEnclosureObjects))
		{
			echo 			$this->OutputHeader("Zoos");
			echo			$this->ZooEnclosureOutput();
		}
			
		if (count($this->PowerStationObjects))
		{
			echo 			$this->OutputHeader("Power Station");
			echo			$this->PowerStationOutput();
		}
		
		
		if (count($this->BusinessObjects) || count($this->PremBusinessObjects) )
		{
			echo 			$this->OutputHeader("Business");
			echo			$this->BusinessOutput();
			echo			$this->PremBusinessOutput();
			echo			$this->TimedBusinessOutput();
		}
			
		if (count($this->MunicipalCenterObjects) || count($this->MunicipalObjects) || count($this->LandmarkObjects))
		{
			echo 			$this->OutputHeader("MunicipalCenter / Community Buildings & Landmarks");
			echo '			<table class="table66">
								<tr height="12">
									<td><b>Options</b>:</td>
									<td>
										<input type="checkbox" id="CCbonus">Streak Bonus<br>
									</td>
								</tr>
							</table>
							<br>';
			echo			$this->MunicipalCenterOutput();
			echo			$this->MunicipalOutput();
			echo			$this->LandmarkOutput();
		}
		
		echo '				<div width="100%" align="center"><hr>
								<button id="btn_save" style="color:white;background-color:#13a89e;border-width:1px;border-style:solid; ">&nbsp;'.$this->t("Save Settings").'&nbsp;</button>
							</div>
							<hr>
						</form>';
						$this->PageTranslations();

		echo '		</body>
				</html>';
	} // End GetForm()
	
	function ResidenceOutput()
	{
		$display = false;
		$output = '	Select the Residences you like to collect:';
		if(!isset($this->settings['collectRentIN'])) $this->settings['collectRentIN'] = array();
		$resNOT="";
		$resN = array();
		$resIN="";
		$resI = array();
		foreach ($this->ResidenceObjects as $key=>$item)
		{
			$display = true;
			$found = "N";
			if (in_array((string)$item['id'],$this->settings['collectRentIN'])) {$found = "Y";}
			if($found == "Y" )
				{ $resI[$item['id']] = (string)$item['itemName'];}
			else
				{ $resN[$item['id']] = (string)$item['itemName'];}
		}
		natcasesort($resI);
		natcasesort($resN);
		foreach ($resI as $id=>$item)
		{
			$obj = $this->ld->GetDTObjectById($id);
			$pop = $obj["currentPopulation"]*10;
			if ($pop == 0) { $pop = $this->xmlsOb->GetResidencesBasePopulation($item)*10; }
			$popmax = $this->xmlsOb->GetResidencesMaxPopulation($item)*10;
			$popstats = $pop." / ".$popmax;
			if ($popmax - $pop == 0) {$full = "(FULL) ";} else {$full = "";}
			$resIN .= '<option value="'.$id.'">'.$full.$item." ($id) : $popstats</option>";
		}
		foreach ($resN as $id=>$item)
		{
			$obj = $this->ld->GetDTObjectById($id);
			$pop = $obj["currentPopulation"]*10;
			if ($pop == 0) { $pop = $this->xmlsOb->GetResidencesBasePopulation($item)*10; }
			$popmax = $this->xmlsOb->GetResidencesMaxPopulation($item)*10;
			$popstats = $pop." / ".$popmax;
			if ($popmax - $pop == 0) {$full = "(FULL) ";} else {$full = "";}
			$resNOT .= '<option value="'.$id.'">'.$full.$item." ($id) : $popstats</option>";
		}
		$output .= '<table class="table0">
						<th>Do NOT collect</th><th></th><th>Do collect</th>
						<tr>
							<td>
								<select name="sell1" size="10" multiple="multiple">';
		$output .=					$resNOT;
		$output .= '			</select>
							</td>
							<td align="center" valign="middle">
								<input type="button" value="--&gt;"onclick="moveOptions(this.form.sell1, this.form.sell2); sortSelect(this.form.sell2)" /><br />
								<input type="button" value="&lt;--"onclick="moveOptions(this.form.sell2, this.form.sell1); sortSelect(this.form.sell1)" />
							</td>
							<td>
								<select name="sell2" size="10" multiple="multiple" id="collectRentIN">';
		$output .= 					$resIN;
		$output .= '   			</select>
							</td>
						</tr>
					</table>';
		$output .= '<br>';
		if ($display)
			return $output;
		else
			return "";
	}
	
	function CustomResidenceOutput()
	{
		$display = false;
		$output = '	Avaliable CustomResidence:
					<table style="width: 100px; background-color: white;border-width: 1px;">
						<tr>
							<td><b>Collect</b></td>
							<td><b>Item</b></td>
							<td><b>ID</b></td>
							<td><b>State</b></td>
							<td><b><center>Population</center></b></td>
							<td><b><center>Max Population</center></b></td>
							<td><b><center>Vacancies</center></b></td>
						</tr>';
			 		
		$i = 0;
		foreach ($this->CustomResidenceObjects as $obj)
		{
			$display = true;
			$output .= '<tr>';
			switch ($obj['itemName']) {
				case 'res_customresidences';
				case 'res_customresidences_2';
				case 'res_customresidences_3';
				case 'res_customresidences_4';
				case 'res_customresidences_5';
					$bgcolor = "E3E3E3";break 1;
			}
			$output .= '<td bgcolor="'.$bgcolor.'"><input type="checkbox" id="collectCustomResidence'.$i.'" objid="'.$obj['id'].'"></td>';$i++;
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['itemName'].'</td>';
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['id'].'</td>';

			if ($obj['state']=="grown")
				{ $output .= '<td bgcolor="'.$bgcolor.'">Ready</td>'; }
			else
				{ $output .= '<td bgcolor="'.$bgcolor.'">Not&nbsp;Ready</td>'; }
		  
			$pop = $obj['currentPopulation']*10;
			if ($pop == 0) {$pop = $this->xmlsOb->GetResidencesBasePopulation($obj['itemName'])*10;}
			$output .= '<td bgcolor="'.$bgcolor.'"><center>'.$pop.'</center></td>';

			$popmax = 0;
			$popmax = $this->xmlsOb->GetResidencesMaxPopulation($obj['itemName']);
			if (is_array($obj['mechanicData']['slots'])){
				foreach($obj['mechanicData']['slots'] as $j=>$floor){
					if (!empty($floor)){
						$popmax += $this->xmlsOb->GetResidencesMaxPopulation($floor);
					}
				}
			}
			$popmax = $popmax * 10;
			  
			$output .= '<td bgcolor="'.$bgcolor.'"><center>'.$popmax.'</center></td>';
			$popdiff = $popmax - $pop;
			if ($popdiff == 0) $popdiff ="FULL";
			$output .= '<td bgcolor="'.$bgcolor.'"><center>'.$popdiff.'</center></td>';
			$output .= '</tr>';
		}
		$output .= '</table><br>';
		if ($display)
			return $output;
		else
			return "";
	}

	function SkyscraperOutput()
	{
		$display = false;
		$output = '	Avaliable Skyscrapers:
					<table style="width: 100px; background-color: white;border-width: 1px;">
						<tr>
							<td><b>Collect</b></td>
							<td><b>Item</b></td>
							<td><b>ID</b></td>
							<td><b>State</b></td>
							<td><b><center>Population</center></b></td>
							<td><b><center>Max Population</center></b></td>
							<td><b><center>Vacancies</center></b></td>
						</tr>';

		$i = 0;
		foreach ($this->SkyscraperObjects as $obj)
		{
			$display = true;
			$output .= '<tr>';
			switch ($obj['itemName']) {
				case 'skyscraper_cetronas_center_1';
				case 'skyscraper_cetronas_center_2';
				case 'skyscraper_cetronas_center_3';
				case 'skyscraper_cetronas_center_4';
				case 'skyscraper_cetronas_center_5';
				case 'skyscraper_cetronas_center_6';
					$bgcolor = "E3E3E3";break 1;
				case 'sky_blueskyscraper_1';
				case 'sky_blueskyscraper_2';
				case 'sky_blueskyscraper_3';
				case 'sky_blueskyscraper_4';
				case 'sky_blueskyscraper_5';
				case 'sky_blueskyscraper_6';
					$bgcolor = "E3E3E3";break 1;
				case 'skyscraper_japanese_1';
				case 'skyscraper_japanese_2';
				case 'skyscraper_japanese_3';
				case 'skyscraper_japanese_4';
				case 'skyscraper_japanese_5';
				case 'skyscraper_japanese_6';
					$bgcolor = "E3E3E3";break 1;
				case 'skyscraper_dubai_1';
				case 'skyscraper_dubai_2';
				case 'skyscraper_dubai_3';
				case 'skyscraper_dubai_4';
				case 'skyscraper_dubai_5';
				case 'skyscraper_dubai_6';
					$bgcolor = "E3E3E3";break 1;
			}
			$output .= '<td bgcolor="'.$bgcolor.'"><input type="checkbox" id="collectsky'.$i.'" objid="'.$obj['id'].'"></td>';$i++;
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['itemName'].'</td>';
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['id'].'</td>';
			$harvestEndTS = $obj["mechanicData"]["harvestEndTS"];
			if($harvestEndTS > time()) {
				$state = "Not&nbsp;Ready";
			}
			else{
				$state = "Ready";
			}
			$output .= '<td bgcolor="'.$bgcolor.'">'.$state.'</td>';
			$pop = $obj['currentPopulation']*10;
			if ($pop == 0) {$pop = $this->xmlsOb->GetResidencesBasePopulation($obj['itemName'])*10;}
			$output .= '<td bgcolor="'.$bgcolor.'"><center>'.$pop.'</center></td>';
			$popmax = $this->xmlsOb->GetResidencesMaxPopulation($obj["itemName"])*10;
			$output .= '<td bgcolor="'.$bgcolor.'"><center>'.$popmax.'</center></td>';
			$popdiff = $popmax - $pop;
			if ($popdiff == 0) $popdiff ="FULL";
			$output .= '<td bgcolor="'.$bgcolor.'"><center>'.$popdiff.'</center></td>';
			$output .= '</tr>';
		}
		$output .= '</table><br>';
		if ($display)
			return $output;
		else
			return "";
	}
	
	function NeighborhoodOutput()
	{
		$display = false;
		$output = '	Avaliable Neighbourhoods:
					<table style="width: 100px; background-color: white;border-width: 1px;">
					<tr>
						<td><b>Collect</b></td>
						<td><b>Item</b></td>
						<td><b>ID</b></td>
						<td><b>Energy</b></td>
						<td><b>State</b></td>		 
						<td><b><center>Population</center></b></td>
						<td><b><center>Max Population</center></b></td>
						<td><b><center>Vacancies</center></b></td>
					</tr>';
		$i = 0;
		foreach ($this->NeighborhoodObjects as $obj)
		{
			$display = true;
			$output .= '<tr>';
			switch ($obj['itemName']) {
				case 'hood_apartments_level1';
				case 'hood_apartments_level2';
				case 'hood_apartments_level3';
					$bgcolor = "FFB90F";break 1;
				case 'hood_vacation_homes_level1';
				case 'hood_vacation_homes_level2';
				case 'hood_vacation_homes_level3';
					$bgcolor = "FFEC8B";break 1;
				case 'hood_gated_community_level1';
				case 'hood_gated_community_level2';
				case 'hood_gated_community_level3';
					$bgcolor = "D2691E";break 1;
				case "hood_mansions_level1";
				case "hood_mansions_level2";
				case "hood_mansions_level3";
					$bgcolor = "FFDEAD";break 1;
				case "hood_family2_level1";
				case "hood_family2_level2";
				case "hood_family2_level3";
					$bgcolor = "D2691E";break 1;
				case "hood_familycomplex_level1";
				case "hood_familycomplex_level2";
				case "hood_familycomplex_level3";
					$bgcolor = "D2691E";break 1;  
				case "hood_halloween";
				case "hood_halloween_level2";
				case "hood_halloween_level3";
					$bgcolor = "CD96CD";break 1;
				case "hood_skyrise_level1";
				case "hood_skyrise_level2";
				case "hood_skyrise_level3";
					$bgcolor = "FFB90F";break 1;
				case "hood_skiresort_level1";
				case "hood_skiresort_level2";
				case "hood_skiresort_level3";
					$bgcolor = "EEE9E9";break 1;
				case "hood_holiday_level1";
				case "hood_holiday_level2";
				case "hood_holiday_level3";
					$bgcolor = "EEE9E9";break 1;
				case "community_level1_district";
				case "community_level2_district";
				case "community_level3_district";
					$bgcolor = "6DA4FF";break 1;
			}
			$output .= '<td bgcolor="'.$bgcolor.'"><input type="checkbox" id="hood_'.$i.'" objid="'.$obj['id'].'"></td>';$i++;
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['itemName'].'</td>';
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['id'].'</td>';
			$output .= '<td bgcolor="'.$bgcolor.'">'.count($obj['mechanicData']['harvestState']['resources']).'</td>';
			$isgrown = true;
			foreach ((array) $obj['mechanicData']['slots'] as $k=>$house)
			{
				if ($house["state"] == 'grown') { $isgrown &= true; }
				else { $isgrown &= false; }
			}
			if ($isgrown) {$output .= '<td bgcolor="'.$bgcolor.'">Ready</td>';}
			else { $output .= '<td bgcolor="'.$bgcolor.'">Not&nbsp;ready</td>'; }
			$pop = 0;
			$popmax = 0;
			foreach((array)$obj['mechanicData']['slots'] as $j=>$house)
			{
				$popmax += $this->xmlsOb->GetResidencesMaxPopulation($house["itemName"]);
				$pop += $house["currentPopulation"];
				if ($house["currentPopulation"] == 0) { $pop += $this->xmlsOb->GetResidencesBasePopulation($house["itemName"]); }
			}
			$pop = $pop * 10;
			$popmax = $popmax * 10;
			$output .= '<td bgcolor="'.$bgcolor.'"><center>'.$pop.'</center></td>';
			$output .= '<td bgcolor="'.$bgcolor.'"><center>'.$popmax.'</center></td>';
			$popdiff = $popmax - $pop;
			if ($popdiff == 0) $popdiff ="FULL";
			$output .= '<td bgcolor="'.$bgcolor.'"><center>'.$popdiff.'</center></td>';
			$output .= '</tr>';
		}
		$output .= '</table><br>';
		if ($display)
			return $output;
		else
			return "";
	}
	
	function HotelOutput()
	{
		$display = false;
		$output = '	Avaliable Hotels:
					<table class="table66" border="1" cellspacing="1" cellpadding="1" width="auto" bgcolor="#ff0066" style="table-layout=fixed">
						<tr>
							<td><b>Process</b></td>
							<td><b>Item</b></td>
							<td><b>Name</b></td>
							<td><b>Goods</b></td>
						</tr>';
		foreach ($this->HotelObjects as $obj)
		{
			$display = true;
			$output .= '<tr align="center" valign="middle">';
			switch ($obj['itemName']) {
				case 'resort_hotel_low';
				case 'resort_hotel_mid';
				case 'resort_hotel_large';
					$output .= '<td width="100"><input type="checkbox" id="hotel_resort" objid="'.$obj['id'].'"></td>';
					break 1;
				case 'hotel_sailboat_low';
				case 'hotel_sailboat_mid';
				case 'hotel_sailboat_large';
					$output .= '<td><input type="checkbox" id="hotel_sailboat" objid="'.$obj['id'].'"></td>';
					break 1;
				case 'tower_of_terror_regular';
					$output .= '<td><input type="checkbox" id="hotel_terror" objid="'.$obj['id'].'"></td>';
					break 1;
				case 'tiki_social_business';
					$output .= '<td><input type="checkbox" id="hotel_tiki" objid="'.$obj['id'].'"></td>';
					break 1;
				case 'casino_social_business';
					$output .= '<td><input type="checkbox" id="hotel_casino" objid="'.$obj['id'].'"></td>';
					break 1;
				case 'bus_lovehotel';
					$output .= '<td><input type="checkbox" id="hotel_honeymoon" objid="'.$obj['id'].'"></td>';
					break 1;
			}
			$output .= '<td>'.$obj['itemName'].'</td>';
			$output .= '<td>'.$obj['mechanicData']['name'].'</td>';
			$output .= '<td>'.$obj['mechanicData']['harvestState']['customersReq'].'</td>';
			$output .= '</tr>';
		}
		$output .= '</table>
					* Process = Visit &#187; Collect &#187; Supply<br>
					<br>';
		if ($display)
			return $output;
		else
			return "";
	}
	
	function MallOutput()
	{
		$display = false;
		$output = '	Avaliable Malls:
					<table style="width: 100px; background-color: white;border-width: 1px;">
						<tr>
							<td><b>Process</b></td>
							<td><b>Item</b></td>
							<td><b>ID</b></td>
							<td><b>Energy</b></td>
							<td><b>Goods</b></td>
						</tr>';
		$i = 0;
		foreach ($this->MallObjects as $obj)
		{
			$display = true;
			$output .= '<tr>';
			switch ($obj['itemName']) {
				case 'mall';
				case 'mall_level2';
				case 'mall_level3';
				case 'mall_level4';
				case 'mall_level5';	
					$bgcolor = "E3E3E3";break 1;
				case 'mall2';
				case 'mall2_level2';
				case 'mall2_level3';
				case 'mall2_level4';
				case 'mall2_level5';	
					$bgcolor = "BEBEBE";break 1;
				case 'mall_food_court';
				case 'mall_food_court_level2';
				case 'mall_food_court_level3';
					$bgcolor = "B0B0B0";break 1;
				case 'mall_fashion_center';
				case 'mall_fashion_center_level2';
				case 'mall_fashion_center_level3';
					$bgcolor = "B0B0B0";break 1;
				case 'mall_level1_district';
				case 'mall_level2_district';
				case 'mall_level3_district';
					$bgcolor = "6DA4FF";break 1;
				case 'mall_solar';
				case 'mall_solar_level2';
				case 'mall_solar_level3';
					$bgcolor = "f7ff0a";break 1;
			}
			$output .= '<td bgcolor="'.$bgcolor.'"><input type="checkbox" id="mall_'.$i.'" objid="'.$obj['id'].'"></td>';$i++;
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['itemName'].'</td>';
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['id'].'</td>';
			$output .= '<td bgcolor="'.$bgcolor.'">'.count($obj['mechanicData']['harvestState']['resources']).'</td>';
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['mechanicData']['harvestState']['customersReq'].'</td>';
			$output .= '</tr>';
		}
		$output .= '</table>
					* Process = Visit &#187; Collect &#187; Supply<br>
					<br>';
		if ($display)
			return $output;
		else
			return "";
	}

	function ThemeParkOutput()
	{
		$display = false;
		$output = '	Avaliable ThemePark:
					<table class="table66" border="1" cellspacing="1" cellpadding="1" width="auto" bgcolor="#ff0066" style="table-layout=fixed">
						<tr>
							<td><b>Process</b></td>
							<td><b>Item</b></td>
							<td><b>Goods</b></td>
						</tr>';

		foreach ($this->ThemeParkObjects as $obj)
		{
			$display = true;
			$output .= '<tr align="center" valign="middle">';
			switch ($obj['itemName']) {
				case 'theme_park_level';
				case 'theme_park_level2';
				case 'theme_park_level3';
					$output .= '<td width="100"><input type="checkbox" id="theme_park" objid="'.$obj['id'].'"></td>'; break 1;
			}
			$output .= '<td>'.$obj['itemName'].'</td>';
			$output .= '<td>'.$obj['mechanicData']['harvestState']['customersReq'].'</td>';
			$output .= '</tr>';
		}
		$output .= '</table>
					* Process = Visit &#187; Collect &#187; Supply<br>
					<br>';
		if ($display)
			return $output;
		else
			return "";
	}

	function ZooEnclosureOutput()
	{
		$display = false;
		$output = '	Avaliable Zoos:
					<table style="width: 100px; background-color: white;border-width: 1px;">
						<tr>
							<td><b>Collect</b></td>
							<td><b>Item</b></td>
							<td><b>State</b></td>
						</tr>';

		$i = 0;
		foreach ($this->ZooEnclosureObjects as $obj)
		{
			$display = true;
			$output .= '<tr>';
			switch ($obj['itemName']) {
				case 'enclosure_jungle';
				case 'enclosure_savannah';
				case 'enclosure_mountain';
				case 'enclosure_arctic';
					$bgcolor = "E3E3E3";break 1;
			}
			$output .= '<td bgcolor="'.$bgcolor.'"><input type="checkbox" id="zoo_'.$i.'" objid="'.$obj['id'].'"></td>';$i++;
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['itemName'].'</td>';
			if ($obj['state']=="grown")
				{ $output .= '<td bgcolor="'.$bgcolor.'">Ready&nbsp;to&nbsp;collect<td>'; }
			else
				{ $output .= '<td bgcolor="'.$bgcolor.'">Not&nbsp;ready&nbsp;yet<td>'; }
			$output .= '</tr>';
		}
		$output .= '</table><br>';
		if ($display)
			return $output;
		else
			return "";
	}

	function PowerStationOutput()
	{
		$display = false;
		$output = '	Power Station:
					<table style="width: 100px; background-color: white;border-width: 1px;">
						<tr>
							<td><b>Collect</b></td>
							<td><b>Item</b></td>
							<td><b>ID</b></td>
						</tr>';
		$i = 0;
		foreach ($this->PowerStationObjects as $obj)
		{
			$display = true;
			$output .= '<tr>';
			switch ($obj['itemName']) {
				case 'mun_dam';
				case 'pow_windmill';	
				case 'mun_electricco';
                case 'mun_electricco_2';
				case 'mun_electricco_3';
				case 'mun_electricco_4';
					$bgcolor = "E3E3E3";break 1;
			}
			$output .= '<td bgcolor="'.$bgcolor.'"><input type="checkbox" id="power'.$i.'" objid="'.$obj['id'].'"></td>';$i++;
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['itemName'].'</td>';
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['id'].'</td>';
		}
		$output .= '</table><br>';
		if ($display)
			return $output;
		else
			return "";
	}

	function BusinessOutput()
	{
		$display = false;
		$output = '	Select the Business you like to collect/supply :';
		if(!isset( $this->settings['collectbbIN'])) $this->settings['collectbbIN'] = array();
		$resNOT="";
		$resN=array();
		$resIN="";
		$resI=array();
		foreach ($this->BusinessObjects as $item)
		{
			$display = true;
			$found = "N";
			if (in_array((string)$item['id'],$this->settings['collectbbIN'])) {$found = "Y";}
			if($found == "Y" )
				{ $resI[$item['id']] = (string)$item['itemName'];}
			else
				{ $resN[$item['id']] = (string)$item['itemName'];}
		}
		natcasesort($resI);
		natcasesort($resN);
		foreach ($resI as $id=>$item)
		{
			$resIN .= '<option value="'.$id.'">'.$item." ($id)</option>";
		}
		foreach ($resN as $id=>$item)
		{
			$resNOT .= '<option value="'.$id.'">'.$item." ($id)</option>";
		}
		$output .= '&nbsp;&nbsp; <table class="table0">
						<th>Do NOT collect/supply</th><th></th><th>Do collect/supply</th></tr>
						<tr>
							<td>
								<select name="sel1" size="10" multiple="multiple">';
		$output .=					$resNOT;
		$output .= ' 			</select>
							</td>
							<td align="center" valign="middle">
								<input type="button" value="--&gt;"onclick="moveOptions(this.form.sel1, this.form.sel2); sortSelect(this.form.sell2)" /><br />
								<input type="button" value="&lt;--"onclick="moveOptions(this.form.sel2, this.form.sel1); sortSelect(this.form.sell1)" />
							</td>
							<td>
								<select name="sel2" size="10" multiple="multiple" id="collectbbIN">';
		$output .=					$resIN;
		$output .= '			</select>
							</td>
						</tr>
					</table>';
		$output .= '<br>
					<table class="table66">
						<th align="left">Collecting</th><th align="left">Actions</th>
						<tr height="12">
							<td>COLLECT Y/N? <input type="checkbox" id="collect"></td>
							<td>
								<input type="radio" id="collectbball" name="collect" value="collectbball" >Collect ALL business buildings.<br>
								<input type="radio" id="collectbb" checked name="collect" value="collectbb" >Collect ONLY business buildings from list.
							</td>
						</tr>
						<tr height="12">
							<td>REPEAT Y/N? <input type="checkbox" id="rcollect"></td>
							<td>
								<input type="text" id="rtimes" value="0" size="4">times<br>
							</td>
						</tr>
						<tr height="12">
							<td>BEFORE Collect <br>Visiting Y/N? <input type="checkbox" id="process"></td>
							<td>&nbsp&nbsp&nbsp Make business buildings instant ready.<br>
								<input type="radio" id="supplybbplusall" name="process" value="supplybbplusall" >Visit ALL business buildings.<br>
								<input type="radio" id="supplybbplus" checked name="process" value="supplybbplus">Visit ONLY business buildings from list.
							</td>
						</tr>
						<tr height="12">
							<td>AFTER Collect <br>Supply Y/N? <input type="checkbox" id="supply"></td>
							<td>
								<input type="radio" id="supplybball" name="supply" value="supplybball" >Supply ALL business buildings with goods.<br>
								<input type="radio" id="supplybb" checked name="supply" value="supplybb" >Supply ONLY business buildings from list with goods.<br>
							</td>
						</tr>
						<tr height="12">
							<td>Extra</td>
							<td>
								<input type="checkbox" id="banditDTbus">Try to capture DT Bandits<br>
								<input type="checkbox" id="Bbonus" checked>Streak Bonus<br><hr>
								<input type="checkbox" id="carsCollect">Collect Cars?<br>
								<input type="checkbox" id="bridgeCollect">Collect Bridge?<br>
							</td>
						</tr>
					</table>
					<br>';
		if ($display)
			return $output;
		else
			return "";
	}
	
	function TimedBusinessOutput()
	{
		$display = false;
		if (count($this->TimedBusinessObjects) > 0)
		{
			$display = true;
			$output = '	<hr>
						<b>Options</b>:
						<br>
						<input type="checkbox" id="actionTimedBusiness">Collect/Supply TimedBusiness
						<br>
						<hr>
						<br>';
		}
		if ($display)
			return $output;
		else
			return "";
	}

	
	function PremBusinessOutput()
	{
		$display = false;
		$output = '	Select the Premium Business you like to collect/supply :';
		if(!isset( $this->settings['collectpbbIN'])) $this->settings['collectpbbIN'] = array();
		$resNOT="";
		$resN=array();
		$resIN="";
		$resI=array();
		foreach ($this->PremBusinessObjects as $item)
		{
			$display = true;
			$found = "N";
			if (in_array((string)$item['id'],$this->settings['collectpbbIN'])) {$found = "Y";}
			if($found == "Y" )
				{ $resI[$item['id']] = (string)$item['itemName'];}
			else
				{ $resN[$item['id']] = (string)$item['itemName'];}
		}
		natcasesort($resI);
		natcasesort($resN);
		foreach ($resI as $id=>$item)
		{
			$obj = $this->ld->GetDTObjectById($id);
			$appraisal = $this->xmlsOb->GetBusinessAppraisal($item);
			if($appraisal == 0) $appraisal = $this->xmlsOb->GetBusinessMaxAppraisal($item);
			$appraisal1 = $obj["mechanicData"]["appraisal_value_increase"];		
			$realappraisal = $appraisal + $appraisal1;
			$appraisalMax = $this->xmlsOb->GetBusinessMaxAppraisal($item);
			$popstats = $realappraisal." / ".$appraisalMax;
			if ($appraisalMax - $realappraisal == 0) {$full = "(FULL) ";} else {$full = "";}	  
			$resIN .= '<option value="'.$id.'">'.$full.$item." ($id) : $popstats</option>";
		}
		foreach ($resN as $id=>$item)
		{
			$obj = $this->ld->GetDTObjectById($id);
			$appraisal = $this->xmlsOb->GetBusinessAppraisal($item);
			if($appraisal == 0) $appraisal = $this->xmlsOb->GetBusinessMaxAppraisal($item);
			$appraisal1 = $obj["mechanicData"]["appraisal_value_increase"];		
			$realappraisal = $appraisal + $appraisal1;
			$appraisalMax = $this->xmlsOb->GetBusinessMaxAppraisal($item);
			$popstats = $realappraisal." / ".$appraisalMax;
			if ($appraisalMax - $realappraisal == 0) {$full = "(FULL) ";} else {$full = "";}	  
			$resNOT .= '<option value="'.$id.'">'.$full.$item." ($id) : $popstats</option>";
		}
		$output .= '&nbsp;&nbsp; <table class="table0">
					<th>Do NOT collect/supply</th><th></th><th>Do collect/supply</th></tr>
						<tr>
							<td>
								<select name="sell4" size="10" multiple="multiple">';
		$output .=					$resNOT;
		$output .= '			</select>
							</td>
							<td align="center" valign="middle">
								<input type="button" value="--&gt;"onclick="moveOptions(this.form.sell4, this.form.sell5); sortSelect(this.form.sell5)" /><br />
								<input type="button" value="&lt;--"onclick="moveOptions(this.form.sell5, this.form.sell4); sortSelect(this.form.sell4)" />
							</td>
							<td>
								<select name="sell5" size="10" multiple="multiple" id="collectpbbIN">';
		$output .=					$resIN;
		$output .= '			</select>
							</td>
						</tr>
					</table>';
		$output .= '<br>
					<table class="table66">
					<th align="left">Collecting</th><th align="left">Actions</th>
						<tr height="12">
							<td>COLLECT Y/N? <input type="checkbox" id="collectPREM"></td>
							<td>
								<input type="radio" id="collectbballPREM" name="collectPREM" value="collectbballPREM" >Collect ALL business buildings.<br>
								<input type="radio" id="collectbbPREM" checked name="collectPREM" value="collectbbPREM" >Collect ONLY business buildings from list.
							</td>
						</tr>
						<tr height="12">
							<td>REPEAT Y/N? <input type="checkbox" id="rcollectprem"></td>
							<td>
								<input type="text" id="rtimesprem" value="0" size="4">times<br>
							</td>
						</tr>
						<tr height="12">
							<td>BEFORE Collect <br>Visiting Y/N? <input type="checkbox" id="processPREM"></td>
							<td>&nbsp&nbsp&nbsp Make business buildings instant ready.<br>
								<input type="radio" id="supplybbplusallPREM" name="processPREM" value="supplybbplusallPREM" >Visit ALL business buildings.<br>
								<input type="radio" id="supplybbplusPREM" checked name="processPREM" value="supplybbplusPREM">Visit ONLY business buildings from list.
							</td>
						</tr>
						<tr height="12">
							<td>AFTER Collect <br>Supply Y/N? <input type="checkbox" id="supplyPREM"></td>
							<td>
								<input type="radio" id="supplybbballPREM" name="supplyPREM" value="supplybbballPREM" >Supply ALL business buildings with premium goods.<br>
								<input type="radio" id="supplybbbPREM" checked name="supplyPREM" value="supplybbbPREM" >Supply ONLY business buildings from list with premium goods.<br>
							</td>
						</tr>
						<tr height="12">
							<td>Extra</td>
							<td>
								<input type="checkbox" id="banditDTpbus">Try to capture DT Bandits<br>
								<input type="checkbox" id="BbonusPREM" checked>Streak Bonus<br>
							</td>
						</tr>
					</table>
					<br>';
		if ($display)
			return $output;
		else
			return "";
	}
	
	function MunicipalCenterOutput()
	{
		$display = false;
		$output = '	Avaliable MunicipalCenter:
					<table style="width: 100px; background-color: white;border-width: 1px;">
						<tr>
							<td><b>Collect</b></td>
							<td><b>Item</b></td>
							<td><b>ID</b></td>
							<td><b>Energy</b></td>
							<td><b>State</b></td>
						</tr>';
		$i = 0;
		foreach ($this->MunicipalCenterObjects as $obj)
		{
			$display = true;
			$output .= '<tr>';
			switch ($obj['itemName']) {
				case 'city_center_1';
				case 'city_center_2';
				case 'city_center_3';
				case 'city_center_4';
				case 'city_center_5';
				case 'city_center_6';				
				case 'city_center_7';	
					$bgcolor = "E3E3E3";break 1;
				case 'mun_govcenter';
				case 'mun_govcenter_2';
				case 'mun_govcenter_3';
				case 'mun_govcenter_4';
				case 'mun_govcenter_5';
				case 'mun_govcenter_6';				
				case 'mun_govcenter_7';	
					$bgcolor = "BEBEBE";break 1;
				case 'learning_center_1';
				case 'learning_center_2';
					$bgcolor = "A1A09A";break 1;
				case 'city_center_1_district';
				case 'city_center_2_district';
				case 'city_center_3_district';
					$bgcolor = "6DA4FF";break 1;
			}
			$output .= '<td bgcolor="'.$bgcolor.'"><input type="checkbox" id="MunCenter'.$i.'" objid="'.$obj['id'].'"></td>';$i++;
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['itemName'].'</td>';
			$output .= '<td bgcolor="'.$bgcolor.'">'.$obj['id'].'</td>';
			$output .= '<td bgcolor="'.$bgcolor.'">'.count($obj['mechanicData']['harvestState']['resources']).'</td>';
			$isgrown = true;
			foreach ((array)$obj['mechanicData']['slots'] as $k=>$house)
			{
				if ($house["state"] == 'grown') { $isgrown &= true; }
				else { $isgrown &= false; }
			}
			if ($isgrown) {$output .= '<td bgcolor="'.$bgcolor.'">Ready&nbsp;to&nbsp;collect<td>';}
			else { $output .= '<td bgcolor="'.$bgcolor.'">Not&nbsp;ready&nbsp;yet<td>'; }
			$output .= '</tr>';
		}
		$output .= '</table><br>';
		if ($display)
			return $output;
		else
			return "";
	}
	
	function MunicipalOutput()
	{
		$display = false;
		$output = '	<input type="checkbox" id="collectMu">'.$this->t("Collect Community Buildings").'?<br>
					<br>
					Select the Community Buildings you like to collect:';
		if(!isset($this->settings['collectMuIN'])) $this->settings['collectMuIN'] = array();
		$resNOT="";
		$resN = array();
		$resIN="";
		$resI = array();
		foreach ($this->MunicipalObjects as $item)
		{
			$display = true;
			$found = "N";
			if (in_array((string)$item['id'],$this->settings['collectMuIN'])) {$found = "Y";}
			if($found == "Y" )
				{ $resI[$item['id']] = (string)$item['itemName'];}
			else
				{ $resN[$item['id']] = (string)$item['itemName'];}
		}
		natcasesort($resI);
		natcasesort($resN);
		foreach ($resI as $id=>$item)
		{
			$resIN .= '<option value="'.$id.'">'.$item." ($id)</option>";
		}
		foreach ($resN as $id=>$item)
		{
			$resNOT .= '<option value="'.$id.'">'.$item." ($id)</option>";
		}
		$output .= '<table class="table0">
						<th>Do NOT collect</th><th></th><th>Do collect</th></tr>
						<tr>
							<td>
								<select name="selll1" size="10" multiple="multiple">';
		$output .=					$resNOT;
		$output .= '    		</select>
							</td>
							<td align="center" valign="middle">
								<input type="button" value="--&gt;"onclick="moveOptions(this.form.selll1, this.form.selll2); sortSelect(this.form.selll2)" /><br />
								<input type="button" value="&lt;--"onclick="moveOptions(this.form.selll2, this.form.selll1); sortSelect(this.form.selll1)" />
							</td>
							<td>
								<select name="selll2" size="10" multiple="multiple" id="collectMuIN">';
		$output .=					$resIN;
		$output .= '   
							</td>
						</tr>
					</table>
					<br>';
		if ($display)
			return $output;
		else
			return "";
	}
	
	function LandmarkOutput()
	{
		$display = false;
		$output = '	<input type="checkbox" id="collectLM">'.$this->t("Collect Landmarks").'?<br>
					<br>
					Select the Landmarks you like to collect:';
		if(!isset($this->settings['collectLMIN'])) $this->settings['collectLMIN'] = array();
		$resNOT="";
		$resN = array();
		$resIN="";
		$resI = array();
		foreach ($this->LandmarkObjects as $item)
		{
			$display = true;
			$found = "N";
			if (in_array((string)$item['id'],$this->settings['collectLMIN'])) {$found = "Y";}
			if($found == "Y" )
				{ $resI[$item['id']] = (string)$item['itemName'];}
			else
				{ $resN[$item['id']] = (string)$item['itemName'];}
		}
		natcasesort($resI);
		natcasesort($resN);
		foreach ($resI as $id=>$item)
		{
			$resIN .= '<option value="'.$id.'">'.$item." ($id)</option>";
		}
		foreach ($resN as $id=>$item)
		{
			$resNOT .= '<option value="'.$id.'">'.$item." ($id)</option>";
		}
		$output .= '<table class="table0">
						<th>Do NOT collect</th><th></th><th>Do collect</th></tr>
						<tr>
							<td>
								<select name="sellll1" size="10" multiple="multiple">';
		$output .=					$resNOT;
		$output .= '			</select>
							</td>
							<td align="center" valign="middle">
								<input type="button" value="--&gt;"onclick="moveOptions(this.form.sellll1, this.form.sellll2); sortSelect(this.form.sellll2)" /><br />
								<input type="button" value="&lt;--"onclick="moveOptions(this.form.sellll2, this.form.sellll1); sortSelect(this.form.sellll1)" />
							</td>
							<td>
								<select name="sellll2" size="10" multiple="multiple" id="collectLMIN">';
		$output .=					$resIN;
		$output .= '			</select>
							</td>
						</tr>
					</table>
					<br>';
		if ($display)
			return $output;
		else
			return "";
	}

	function NotUsedInDownTown()
	{
			
// ================================================================================			
  echo '     <table border="1" cellspacing="1" cellpadding="1" width="100%" bgcolor="#ff0066">
             <tr height="23">
              <td><h3>Trees</h3></td>
             </tr>
            </table>
            <input type="checkbox" id="ClearWildernes">'.$this->t("Clear Wildernes").'?<br>
            <br>
			<table border="1" cellspacing="1" cellpadding="1" width="100%" bgcolor="#ff0066">
             <tr height="23">
              <td><h3>'.$this->t("Santas Sleigh").'</h3></td>
             </tr>
            </table>
            <input type="checkbox" id="collectSleigh">'.$this->t("Collect Sleigh").'?<br><br>
            <table border="1" cellspacing="1" cellpadding="1" width="100%" bgcolor="#ff0066">
             <tr height="23">
              <td><h3>'.$this->t("Daily Bonus").'</h3></td>
             </tr>
            </table>
            <input type="checkbox" id="AcceptDayBonus">'.$this->t("Accept daily bonus").'<br>
            <br>';
			
	}
	
	function PageTranslations()
	{
		echo '<i>This page is available in: ';
		//var_dump($this->translate->getList());
		foreach($this->translate->getList() as $code )
		{
			//  if($language == $code ){$selected = " SELECTED";}else{$selected = " ";}
			echo $this->t($code).' ';
		}
		echo '</i><br>';
	}

}

?>